//
//  QLNetWorking.h
//  青旅OA
//
//  Created by qlwl on 16/4/19.
//  Copyright © 2016年 qlwl. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>

//参数分割符
#define ParameterSegmentationCharacter @"&"
//键值分割符
#define KeyValueSegmentationCharacter @"="


@interface QLNetWorking : NSObject
//开始网络状态的监测、、、一般在appDelegate中就开始网络状态监测
+ (void)startMonitoring;
//结束网络状态的监测
+ (void)stopMonitoring;
//网络状态的监测
+ (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block;
//是否连接网络
+(BOOL)canLinkNetWorking;
//get请求
+ (void)getJSONWithUrl:(NSString *)urlStr parameters:(id)parameters isJosnRequest:(BOOL)isJosn progress:(void(^)(NSProgress *downloadProgress))progress success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//get请求没有进度
+ (void)getJSONWithUrl:(NSString *)urlStr parameters:(id)parameters success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//post请求
+ (void)postJSONWithUrl:(NSString *)urlStr parameters:(id)parameters isJosnRequest:(BOOL)isJosn rogress:(void(^)(NSProgress *downloadProgress))progress success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;

/**
 *  post请求
 */
+ (void)postJSONWithUrl:(NSString *)urlStr parameters:(id)parameters success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//提交图片
+(void)upImaWithURL:(NSString *)urlStr parameters:(id)parameters fieldNames:(NSArray *)files andImaNames:(NSArray *)imaNames mimeType:(NSString *)mimeType andImas:(NSArray *)imasArray progress:(void(^)(NSProgress *uploadProgress))progress success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
+(void)upImaWithURL:(NSString *)urlStr parameters:(id)parameters fieldName:(NSString *)file andImas:(NSArray *)imasArray progress:(void(^)(NSProgress *uploadProgress))progress success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//提交照片没有进度
+(void)upImaWithURL:(NSString *)urlStr parameters:(id)parameters fieldName:(NSString *)file andImas:(NSArray *)imasArray success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//提交文件
+(void)upFileWithURL:(NSString *)urlStr parameters:(id)parameters isJosnRequest:(BOOL)isJosn constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block progress:(void(^)(NSProgress *uploadProgress))progress success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;
//提交文件没有进度
+(void)upFileWithURL:(NSString *)urlStr parameters:(id)parameters constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block success:(void (^)(id result))success fail:(void (^)(NSError *error))fail;

+(id) getPostJsonWithDict:(NSDictionary *)dict;
+ (id) getPostDictWithPostStr:(id)postStr;

//+(BOOL)sucess:(NSDictionary *)result;
+(BOOL)sucess:(NSDictionary *)result and:(NSString *)key EqualToString:(NSString *)string;
+ (NSString *)resultMessage:(NSDictionary *)result;
@end
